<?

include "funct.php";

if (isset($_POST["nume"], $_POST["parola"])) {
	clean($_POST["nume"]);
	clean($_POST["parola"]);
	$rezultat = mysql_query("select * from " . $db["users"] . " where name='" . $_POST["nume"] . "' and password='" . md5($_POST["parola"]) . "' and function='admin'");
	if (mysql_num_rows($rezultat) == 1) {
		$rand = mysql_fetch_array($rezultat);
		$_SESSION["admin"] = $rand["id"];
		mysql_query("update " . $db["users"] . " set last_visit='" . ceas() . "', logat='1' where id='" . $rand["id"] . "'");
		header("Location: logged.php");
	}
	else
		message_i($lang["wrong_l"]);
}
else
	iesire();
?>
